package top.kiterunner.learning.data_structure.TrieTree;

/**
 * AdorynZhao in Tencent-UESTC.
 * Source Code Created on 2017/7/9.
 */
public class TrieTreeTest {

    public static void main(String[] args) {

        String[] words = {
            "hello",
            "he",
            "position",
            "post",
            "have",
            "hand",
            "dust",
        };

        String[] prefixes = {
            "h",
            "he",
            "pos",
            "post",
            "ha",
            "hav",
            "dud"
        };

        TrieTree tree = new TrieTree();

        for (String word : words) {
            tree.insertNode(word);
        }

        for (String prefix : prefixes) {
            System.out.println("Prefix [" + prefix + "] Count = " + tree.findCount(prefix));
        }

    }
}
